package com.youyi.yyfilepickerlibrary.core.adapter;

import android.graphics.Bitmap;
import android.media.MediaMetadataRetriever;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lkx.liandianqinew.R;
import com.youyi.yyfilepickerlibrary.SDK.FileTypeEnum;
import com.youyi.yyfilepickerlibrary.core.model.EssFile;
import java.util.List;

public class FileListAdapter extends BaseQuickAdapter<EssFile, BaseViewHolder> {
    private onLoadFileCountListener loadFileCountListener;

    public interface onLoadFileCountListener {
        void onLoadFileCount(int i);
    }

    public onLoadFileCountListener getLoadFileCountListener() {
        return this.loadFileCountListener;
    }

    public void setLoadFileCountListener(onLoadFileCountListener onloadfilecountlistener) {
        this.loadFileCountListener = onloadfilecountlistener;
    }

    public FileListAdapter(List<EssFile> list) {
        super(R.layout.item_file_list, list);
    }

    /* JADX INFO: Can't fix incorrect switch cases order, some code will duplicate */
    /* access modifiers changed from: protected */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x00db, code lost:
        if (r0.equals("jpg") == false) goto L_0x00b2;
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void convert(BaseViewHolder r8, EssFile r9) {
        /*
        // Method dump skipped, instructions count: 418
        */
        throw new UnsupportedOperationException("Method not decompiled: com.youyi.yyfilepickerlibrary.core.adapter.FileListAdapter.convert(com.chad.library.adapter.base.BaseViewHolder, com.youyi.yyfilepickerlibrary.core.model.EssFile):void");
    }

    private int getFileImg(EssFile essFile, String str) {
        FileTypeEnum fileTypeEnum;
        FileTypeEnum[] values = FileTypeEnum.values();
        int length = values.length;
        int i = 0;
        while (true) {
            if (i >= length) {
                fileTypeEnum = null;
                break;
            }
            fileTypeEnum = values[i];
            if (str.toLowerCase().equals(fileTypeEnum.getEndName().toLowerCase())) {
                break;
            }
            i++;
        }
        if (fileTypeEnum != null) {
            return fileTypeEnum.getImg();
        }
        if (essFile.isDirectory()) {
            return R.mipmap.folder;
        }
        return R.mipmap.documents;
    }

    public static Bitmap getVideoThumb(String str) {
        try {
            MediaMetadataRetriever mediaMetadataRetriever = new MediaMetadataRetriever();
            mediaMetadataRetriever.setDataSource(str);
            return mediaMetadataRetriever.getFrameAtTime();
        } catch (Exception unused) {
            return null;
        }
    }
}
